package com.ruoyi.web.sso.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.web.sso.domain.DTO.AreaDTO;
import com.ruoyi.web.sso.domain.vo.AreaVO;
import com.ruoyi.web.sso.service.IAreaService;
import com.ruoyi.web.sso.service.TongBangCookbookService;
import com.ruoyi.web.sso.util.CopyUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/sso/tongbang")
@Slf4j
@Api(tags = "童帮 - 食谱")
public class TongBangCookbookController {

    @Autowired
    private TongBangCookbookService tongBangCookbookService;

    @Autowired
    private IAreaService areaService;


    @ApiOperation(value = "园区信息创建带量食谱")
    @PostMapping("/create")
    @ResponseBody
    public AjaxResult tongBangAreaCreate(String areaId) {
        AreaVO areaVO = areaService.selectAreaById(areaId);
        AreaDTO areaDTO = new AreaDTO();
        CopyUtils.copyProperties(areaVO,areaDTO);
        areaDTO.setName(areaVO.getAreaName());
        tongBangCookbookService.tongbangAreaCreate(areaDTO);
        return AjaxResult.success("成功");
    }

//
//
//    @ApiOperation(value = "食谱URL")
//    @PostMapping("/auth_url")
//    @ApiResponses({
//            @ApiResponse(code = 200,message = "OK",response = String.class),
//    })
//    public StatusResponse cookBookURL(@RequestHeader(TICKET) String ticket) throws  Exception{
//        AreaDTO area = ssoCallService.getAreaDTO(ticket);
//        String url = tongBangCookbookService.cookBookURL(ticket, area);
//        return StatusResponse.success(url);
//    }

}
